/*
 * @ProjectName: 编程学习
 * @Copyright:   2019 HangZhou Yi Dev, Ltd. All Right Reserved.
 * @address:     https://yiyuery.github.io/
 * @date:        2019/12/10 11:30 下午
 * @email:       xiazhaoyang@live.com
 * @description: 本内容仅限于编程技术学习使用，转发请注明出处.
 */
package com.example.spring.aop.advice;

import lombok.extern.slf4j.Slf4j;
import org.springframework.aop.ThrowsAdvice;

import java.lang.reflect.Method;

/**
 * <p>
 *  后置增强
 * </p>
 *
 * @author Yi
 * @version V1.0.0
 * @date 2019/12/10 11:30 下午
 * @modificationHistory=========================逻辑或功能性重大变更记录
 * @modify By: {修改人}  2019/12/10
 * @modify reason: {方法名}:{原因}
 * ...
 */
@Slf4j
public class BusinessLogHandlerThrowExceptionAdvice implements ThrowsAdvice {

    /**
     * ThrowsAdvice 是个标签接口，运行期 Spring 使用反射机制自行判断，必须采用签名形式定义异常抛出的增强方法
     * void afterThrowing(Method method,Object args,Object target,Throwable ex)
     * @param method
     * @param args
     * @param target
     * @param ex
     * @throws Throwable
     */
    public void afterThrowing(Method method,Object args,Object target,Exception ex) throws Throwable{
        log.error("BusinessLogHandlerThrowExceptionAdvice >>> method: "+ method.getName());
    }
}
